#include <stdio.h>
#include <stdlib.h>

int main (int argc, char const* argv[])
{
    int n, ans, last, distance, i, t; 

    while (scanf("%d", &n) != EOF) {
        if (0 == n) break;

        ans = n * 5;
        last = 0;
        for (i = 0; i < n; i++) {
            scanf("%d", &t);
            distance = last - t;

            if (distance > 0) {
                ans += distance * 4;
            } else {
                ans += abs(distance) * 6;
            }

            last = t;
        }

        printf("%d\n", ans);
    }

    return 0;
}
